package com.briup.cms.service.impl;

import com.briup.cms.bean.Inform;
import com.briup.cms.bean.extend.InformExtend;
import com.briup.cms.dao.InformMapper;
import com.briup.cms.service.IInformService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;


@Service
public class InformServiceImpl implements IInformService {
    @Resource
    private InformMapper informMapper;

    @Override
    public List<Inform> findAll() {
        List<Inform> list = informMapper.selectAll();
        return list;
        /*return informMapper.selectAll();*/
    }

    @Override
    public void insertOrUpdate(Inform inform) {
        if (inform.getId()!=null){
            informMapper.update(inform);
        }
        else{
            informMapper.insert(inform);
        }
    }

    @Override
    public void deleteByld(Long id) {
        informMapper.delete(id);
    }

    @Override
    public List<InformExtend> findAllWithArticle(){
        return informMapper.selectAllWithArticle();
    }
}